package com.mikewong.tool.tesseract.Activity;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.TextView;

import com.alibaba.fastjson.JSON;
import com.mikewong.tool.tesseract.Utils.StorageData.IdCardData;
import com.mikewong.tool.tesseract.Utils.StorageData.IdCardList;
import com.mikewong.tool.tesseract.R;
import com.mikewong.tool.tesseract.Utils.StorageData.ExternalStorageUtils;
import com.mikewong.tool.tesseract.Utils.adapter.LvUnitAdpt;
import com.mikewong.tool.tesseract.Utils.adapter.ViewHolder;

public class ListActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_list);

        TextView tv1 = (TextView) findViewById(R.id.tv1);
        ListView lv = (ListView) findViewById(R.id.lvList);
        lv.setAdapter(new LvUnitAdpt<IdCardData>(this, ExternalStorageUtils.getIdCardList().getData(), R.layout.item_1) {
            @Override
            public void convert(ViewHolder helper, IdCardData item) {
                helper.setText(R.id.tv1, item.getName());
                helper.setText(R.id.tv2, item.getSex());
                helper.setText(R.id.tv3, item.getNation());
                helper.setText(R.id.tv4, item.getBirthday());
                helper.setText(R.id.tv5, item.getAddress());
                helper.setText(R.id.tv6, item.getNumber());
                helper.setText(R.id.tv7, item.getText());
            }
        });
    }
}
